From 82a0b78695f788033739d934b17b5931a415c772 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Sat, 27 Aug 2005 20:29:49 +0000 Subject: [PATCH] adding the foundation of extensions --- ChangeLog | 46 +++++++++ babl.pc.in | 4 +- babl/Makefile.am | 8 +- babl/babl-classes.c | 13 ++- babl/babl-classes.h | 27 +++--- babl/babl-component.h | 4 +- babl/babl-conversion.c | 21 ++++- babl/babl-conversion.h | 4 +- babl/babl-core.c | 115 +++++++++++++++++++++++ babl/{base/type-double.c => babl-core.h} | 45 +-------- babl/babl-db.h | 17 ++-- babl/babl-fish.h | 6 +- babl/babl-format.h | 2 + babl/babl-ids.h | 13 +-- babl/babl-internal.c | 13 ++- babl/babl-internal.h | 57 +++++++++-- babl/babl-introspect.c | 53 +++++++---- babl/babl-introspect.h | 4 +- babl/babl-memory.c | 5 +- babl/babl-model.h | 2 + babl/babl-pixel-format.h | 2 + babl/babl-sampling.h | 4 +- babl/babl-sanity.c | 4 +- babl/babl.c | 11 ++- babl/babl.h | 2 - babl/base/Makefile.am | 1 - babl/base/babl-base.c | 6 +- babl/base/model-rgb.c | 37 -------- docs/index-static.html.in | 12 +++ tests/Makefile.am | 3 +- tests/introspect.c | 2 +- 31 files changed, 379 insertions(+), 164 deletions(-) create mode 100644 babl/babl-core.c rename babl/{base/type-double.c => babl-core.h} (51%) diff --git a/ChangeLog b/ChangeLog index e289389..2ed0813 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,49 @@ +2005-08-27 Øyvind Kolås + + * Makefile.am: + * babl.pc.in: added -dl + * babl/babl-classes.c: Added BablExtension to string list of types. + * babl/babl-classes.h: Added BablExtension, some reordering in union. + * babl/babl-conversion.c: + (create_name), (babl_conversion_new): compute the name of the + conversion instead of explicitly having to provide it. + * babl/babl-core.c: + (convert_double_double), (copy_strip_1), + (babl_core_init): Moved double datatype and RGBA model from + base into core. + * babl/babl-core.h: new file + * babl/babl-db.h: improved logging, print current extender as well. + * babl/babl-ids.h: removed some non central ids. + * babl/babl-internal.h: new varargs based logger. + * babl/babl-introspect.c: (babl_introspect): use quiet "fake" + extender. Allow introspection of single objects. + * babl/babl-introspect.h: Allow introspection of single objects. + * babl/babl-memory.c: (babl_memory_sanity): use babl_log instead of + fprintf. + * babl/babl-sanity.c: (id_sanity): only complain about id==0 in + BablBase / BablCore. + * babl/babl.c: (babl_init), (babl_destroy): added core and extension + to build up/tear down lists. + * babl/babl.h: removed babl_introspect which doesn't belong here + anymore. + * babl/base/Makefile.am: Removed type-double.c + * babl/base/babl-base.c: (types), (models): removed + babl_base_type_double () + * babl/base/model-rgb.c: (components), (models): removed RGBA model. + * babl/base/type-double.c: removed + + * docs/index-static.html.in: + * tests/Makefile.am: LDADD += -ldl + * tests/introspect.c: (main): pass NULL as argument to + babl_introspect () to do full objectspace traversal. + + * babl/babl-fish.h: + * babl/babl-model.h: + * babl/babl-pixel-format.h: + * babl/babl-sampling.h: + * babl/babl-conversion.h: + * babl/babl-component.h: cosmetic rearrangement of lines. + 2005-08-27 Øyvind Kolås * babl/babl-component.c: (babl_component_new): diff --git a/babl.pc.in b/babl.pc.in index 8635189..4b995f3 100644 --- a/babl.pc.in +++ b/babl.pc.in @@ -6,6 +6,6 @@ includedir=@includedir@ Name: babl Description: Dynamic; any to any, pixel format conversion library Version: @VERSION@ -Libs: -L${libdir} -lbabl -Cflags: -I${includedir}/babl +Libs: -L${libdir} -lbabl -ldl +Cflags: -I${includedir}/babl-0.0/babl diff --git a/babl/Makefile.am b/babl/Makefile.am index 46efd33..a8f2465 100644 --- a/babl/Makefile.am +++ b/babl/Makefile.am @@ -5,8 +5,10 @@ SUBDIRS = base c_sources = \ babl.c \ babl-classes.c \ + babl-core.c \ babl-component.c \ babl-conversion.c \ + babl-extension.c \ babl-fish.c \ babl-image.c \ babl-introspect.c \ @@ -21,8 +23,10 @@ c_sources = \ h_sources = \ babl-classes.h \ babl-component.h \ + babl-core.h \ babl-conversion.h \ babl-db.h \ + babl-extension.h \ babl-ids.h \ babl-instance.h \ babl-internal.h \ @@ -44,8 +48,11 @@ library_include_HEADERS = \ babl-classes.h \ babl-component.h \ babl-conversion.h \ + babl-extension.h \ babl-fish.h \ + babl-ids.h \ babl-image.h \ + babl-instance.h \ babl-model.h \ babl-pixel-format.h \ babl-sampling.h \ @@ -64,4 +71,3 @@ libbabl_la_LDFLAGS= \ EXTRA_DIST := \ .cvsignore - diff --git a/babl/babl-classes.c b/babl/babl-classes.c index 479ac68..749d58f 100644 --- a/babl/babl-classes.c +++ b/babl/babl-classes.c @@ -17,7 +17,7 @@ * Boston, MA 02111-1307, USA. */ -#include "babl-classes.h" +#include "babl-internal.h" static const char *class_names[] = { @@ -38,6 +38,7 @@ static const char *class_names[] = "BablFish", "BablFishReference", "BablImage", + "BablExtenstion", "BablSky" }; @@ -53,3 +54,13 @@ babl_class_name (BablClassType klass) */ int babl_hmpf_on_name_lookups = 0; +void +babl_internal_init (void) +{ +} + +void +babl_internal_destroy (void) +{ +} + diff --git a/babl/babl-classes.h b/babl/babl-classes.h index 3811934..1ee34db 100644 --- a/babl/babl-classes.h +++ b/babl/babl-classes.h @@ -75,13 +75,12 @@ typedef enum { BABL_FISH_REFERENCE, BABL_IMAGE, + BABL_EXTENSION, + BABL_SKY } BablClassType; -#define BABL_CLASS_TYPE_IS_VALID(klass_type) \ - ( ((klass_type)>=BABL_INSTANCE ) && ((klass_type)<=BABL_SKY) ?1:0 ) -const char *babl_class_name (BablClassType klass); /* common header for any item inserted into database */ typedef struct @@ -89,9 +88,11 @@ typedef struct BablClassType class_type; int id; /*< a numerical id, look at 'babl-ids.h' for the reserved ones */ + void *creator; char *name; /*< the name this type exists under */ } BablInstance; + typedef struct BablConversion { BablInstance instance; @@ -160,6 +161,7 @@ typedef struct * mantissa */ } BablTypeFloat; + typedef struct { BablInstance instance; @@ -226,7 +228,6 @@ typedef struct union Babl *destination; } BablFish; - /* BablFishReference on the double versions of conversions * that are required to exist for maximum sanity. * @@ -244,6 +245,13 @@ typedef struct BablFish fish; } BablFishReference; +typedef struct +{ + BablInstance instance; /* path to .so / .dll is stored in instance name */ + void *dl_handle; + void (*destroy) (void); +} BablExtension; + typedef union { BablClassType class_type; @@ -254,18 +262,11 @@ typedef union BablModel model; BablFormat format; BablConversion conversion; + BablImage image; BablFish fish; BablFishReference reference_fish; - BablImage image; + BablExtension extension; } Babl; - -#define BABL_IS_BABL(obj) \ -(NULL==(obj)?0: \ - BABL_CLASS_TYPE_IS_VALID(((Babl*)(obj))->class_type) \ -) - -#include "babl-instance.h" - #endif diff --git a/babl/babl-component.h b/babl/babl-component.h index dc7c26a..6ad5d8c 100644 --- a/babl/babl-component.h +++ b/babl/babl-component.h @@ -21,6 +21,8 @@ #define _BABL_COMPONENT_H #include "babl-classes.h" -BABL_DEFINE_CLASS (babl_component) +#include "babl-instance.h" + +BABL_DEFINE_CLASS (babl_component) #endif diff --git a/babl/babl-conversion.c b/babl/babl-conversion.c index 278dfc7..80a4a74 100644 --- a/babl/babl-conversion.c +++ b/babl/babl-conversion.c @@ -19,6 +19,7 @@ #include "babl-internal.h" #include "babl-db.h" +#include "babl-extension.h" #include "assert.h" #include #include @@ -123,6 +124,24 @@ conversion_new (const char *name, return babl; } +static char buf[512]=""; +static char * +create_name (Babl *source, Babl *destination) +{ + + if (babl_extender ()) + { + snprintf (buf, 512-1, "%s::%s to %s", BABL(babl_extender())->instance.name, source->instance.name, destination->instance.name); + buf[511]='\0'; + } + else + { + snprintf (buf, 512-1, "%s to %s", source->instance.name, destination->instance.name); + buf[511]='\0'; + } + return buf; +} + Babl * babl_conversion_new (const char *name, ...) @@ -210,7 +229,7 @@ babl_conversion_new (const char *name, assert (source); assert (destination); - babl = conversion_new (name, id, source, destination, time_cost, loss, linear, + babl = conversion_new (create_name (source, destination), id, source, destination, time_cost, loss, linear, planar, planar_bit); if (db_insert (babl) == babl) diff --git a/babl/babl-conversion.h b/babl/babl-conversion.h index 286d6a2..a3d1c6a 100644 --- a/babl/babl-conversion.h +++ b/babl/babl-conversion.h @@ -21,12 +21,12 @@ #define BABL_CONVERSION_H #include "babl-classes.h" - -BABL_DEFINE_CLASS (babl_conversion) +#include "babl-instance.h" void babl_conversion_process (BablConversion *conversion, void *source, void *destination, long n); +BABL_DEFINE_CLASS (babl_conversion) #endif diff --git a/babl/babl-core.c b/babl/babl-core.c new file mode 100644 index 0000000..90cb7ec --- /dev/null +++ b/babl/babl-core.c @@ -0,0 +1,115 @@ +#include +#include "util.h" +#include "babl.h" + +static void +convert_double_double (void *src, + void *dst, + int src_pitch, + int dst_pitch, + int n) +{ + if (src_pitch == 64 && + dst_pitch == 64) + { + memcpy (dst, src, n/8); + return; + } + while (n--) + { + (*(double *) dst) = (*(double *) src); + dst += dst_pitch; + src += src_pitch; + } +} + + +static void +copy_strip_1 (int src_bands, + void **src, + int *src_pitch, + int dst_bands, + void **dst, + int *dst_pitch, + int n) +{ + BABL_PLANAR_SANITY + while (n--) + { + int i; + + for (i=0;i -#include +#ifndef BABL_CORE_H +#define BABL_CORE_H -#include "babl.h" +void babl_core_init (void); -static void -convert_double_double (void *src, - void *dst, - int src_pitch, - int dst_pitch, - int n) -{ - if (src_pitch == 64 && - dst_pitch == 64) - { - memcpy (dst, src, n/8); - return; - } - while (n--) - { - (*(double *) dst) = (*(double *) src); - dst += dst_pitch; - src += src_pitch; - } -} - -void -babl_base_type_double (void) -{ - babl_type_new ( - "double", - "id", BABL_DOUBLE, - "bits", 64, - NULL); - - babl_conversion_new ( - "babl-base: double to double", - "source", babl_type_id (BABL_DOUBLE), - "destination", babl_type_id (BABL_DOUBLE), - "linear", convert_double_double, - NULL - ); -} +#endif diff --git a/babl/babl-db.h b/babl/babl-db.h index 8dd0884..1b1c937 100644 --- a/babl/babl-db.h +++ b/babl/babl-db.h @@ -26,6 +26,7 @@ #endif #include "babl-instance.h" +#include "babl-extension.h" #include @@ -101,7 +102,6 @@ db_destroy (void) db = NULL; } - DB_DEF Babl * db_insert (Babl *babl) { @@ -117,14 +117,14 @@ db_insert (Babl *babl) if (collision) { - if (!strcmp (collision->instance.name, babl->instance.name)) - babl_log ("conflicting name: existing(%i:'%s') - new(%i:'%s')", - collision->instance.id, collision->instance.name, - babl->instance.id, babl->instance.name); + if (!strcmp (collision->instance.name, babl->instance.name) ) + babl_log ("conflicting name:\n\t\tnew: '%s'\n\t\texisting '%s' from %s", + babl->instance.name, collision->instance.name, + BABL(collision->instance.creator)->instance.name); else if (collision->instance.id == babl->instance.id) - babl_log ("conflicting id: existing(%i:'%s') - new(%i:'%s')", - collision->instance.id, collision->instance.name, - babl->instance.id, babl->instance.name); + babl_log ("conflicting id:\n\t\tnew: '%s' (id=%i)\n\t\texisting '%s' from %s", + babl->instance.name, babl->instance.id, collision->instance.name, + BABL(collision->instance.creator)->instance.name); return collision; } @@ -145,6 +145,7 @@ db_insert (Babl *babl) memset (db + db_size, 0, DB_INCREMENT_SIZE * sizeof (Babl*)); db_size += DB_INCREMENT_SIZE; } + babl->instance.creator = babl_extender (); db[db_entries++]=babl; return babl; } diff --git a/babl/babl-fish.h b/babl/babl-fish.h index 5bb2553..0b15bb2 100644 --- a/babl/babl-fish.h +++ b/babl/babl-fish.h @@ -21,8 +21,7 @@ #define BABL_FISH_H #include "babl-classes.h" - -BABL_DEFINE_CLASS_NO_NEW_NO_ID(babl_fish) +#include "babl-instance.h" /** create a new BablFish capable of translating between the pixel * formats given in source and destination. (use babl_format (string)) @@ -44,4 +43,7 @@ int babl_process (Babl *babl_fish, */ int babl_fish_needs_image (Babl *babl_fish); + + +BABL_DEFINE_CLASS_NO_NEW_NO_ID(babl_fish) #endif diff --git a/babl/babl-format.h b/babl/babl-format.h index 2a5f879..ed3329c 100644 --- a/babl/babl-format.h +++ b/babl/babl-format.h @@ -21,6 +21,8 @@ #define _BABL_FORMAT_H #include "babl-classes.h" +#include "babl-instance.h" + BABL_DEFINE_CLASS (babl_format) #endif diff --git a/babl/babl-ids.h b/babl/babl-ids.h index 4de9d89..c0fc313 100644 --- a/babl/babl-ids.h +++ b/babl/babl-ids.h @@ -35,6 +35,7 @@ enum { BABL_U16_CIE_AB, BABL_U8_CIE_L, BABL_U8_CIE_AB, + BABL_TYPE_LAST_INTERNAL, BABL_MODEL_BASE = 1000, BABL_RGB, @@ -51,9 +52,7 @@ enum { BABL_YCBCR_ALPHA, BABL_CIE_LAB, BABL_CIE_LAB_ALPHA, - BABL_CMY, - BABL_CMYK, - BABL_CMYK_ALPHA, + BABL_MODEL_LAST_INTERNAL, BABL_COMPONENT_BASE = 10000, BABL_RED, @@ -77,13 +76,8 @@ enum { BABL_CIE_B, BABL_CB, BABL_CR, - BABL_CYAN, - BABL_MAGENTA, - BABL_YELLOW, - BABL_KEY, - BABL_Z_BUFFER, BABL_PADDING, - + BABL_COMPONENT_LAST_INTERNAL, BABL_FORMAT_BASE = 100000, BABL_SRGB, @@ -102,6 +96,7 @@ enum { BABL_YCBCR411, BABL_YCBCR422, BABL_YCBCR420, + BABL_FORMAT_LAST_INTERNAL, BABL_PIXEL_USER_BASE, }; diff --git a/babl/babl-internal.c b/babl/babl-internal.c index 479ac68..749d58f 100644 --- a/babl/babl-internal.c +++ b/babl/babl-internal.c @@ -17,7 +17,7 @@ * Boston, MA 02111-1307, USA. */ -#include "babl-classes.h" +#include "babl-internal.h" static const char *class_names[] = { @@ -38,6 +38,7 @@ static const char *class_names[] = "BablFish", "BablFishReference", "BablImage", + "BablExtenstion", "BablSky" }; @@ -53,3 +54,13 @@ babl_class_name (BablClassType klass) */ int babl_hmpf_on_name_lookups = 0; +void +babl_internal_init (void) +{ +} + +void +babl_internal_destroy (void) +{ +} + diff --git a/babl/babl-internal.h b/babl/babl-internal.h index 8879c82..3b6225f 100644 --- a/babl/babl-internal.h +++ b/babl/babl-internal.h @@ -26,21 +26,66 @@ #include #include +#include "babl-classes.h" +#include "babl-instance.h" + #include "babl-ids.h" #include "babl-util.h" #include "babl-memory.h" +#include "babl-introspect.h" + #include "babl-classes.h" /* internal classes */ #include "babl-conversion.h" +#include "babl-extension.h" /* */ -#define babl_log(args...) do { \ - fprintf (stdout, "%s:%i %s() ", \ - __FILE__, __LINE__, __FUNCTION__); \ - fprintf (stdout, args); \ - fprintf (stdout, "\n"); \ -} while (0) +/**** LOGGER ****/ +#include + +static inline void +real_babl_log (const char *file, + int line, + const char *function, + const char *fmt, ...) +{ + Babl *extender = babl_extender(); + va_list varg; + + + if (extender != babl_extension_quiet_log()) + { + if (babl_extender()) + fprintf (stdout, "When loading %s:\n\t", babl_extender()->instance.name); + + fprintf (stdout, "%s:%i %s()\n\t", file, line, function); + } + + va_start (varg, fmt); + vfprintf (stdout, fmt, varg); + va_end (varg); + + fprintf (stdout, "\n"); +} + +#define babl_log(args...) real_babl_log(__FILE__, __LINE__, __FUNCTION__, args) + +/********************/ + +#define BABL_CLASS_TYPE_IS_VALID(klass_type) \ + ( ((klass_type)>=BABL_INSTANCE ) && ((klass_type)<=BABL_SKY) ?1:0 ) + +#define BABL_IS_BABL(obj) \ +(NULL==(obj)?0: \ + BABL_CLASS_TYPE_IS_VALID(((Babl*)(obj))->class_type) \ +) + +extern int babl_hmpf_on_name_lookups; + +const char *babl_class_name (BablClassType klass); +void babl_internal_init (void); +void babl_internal_destroy (void); extern int babl_hmpf_on_name_lookups; diff --git a/babl/babl-introspect.c b/babl/babl-introspect.c index a933b28..fb3ed80 100644 --- a/babl/babl-introspect.c +++ b/babl/babl-introspect.c @@ -20,46 +20,63 @@ #include "babl.h" #include "babl-internal.h" /* for babl_log */ +#define BABL_LOG + #ifdef BABL_LOG static void sampling_introspect (Babl *babl); static void model_introspect (Babl *babl); static void type_introspect (Babl *babl); static void format_introspect (Babl *babl); + static int each_introspect (Babl *babl, void *user_data); #endif +extern Babl *babl_extension_current_extender; void -babl_introspect (void) +babl_introspect (Babl *babl) { #ifdef BABL_LOG - babl_log ("Introspection report%s",""); - babl_log ("====================================================%s" ,""); + Babl *extender_backup = babl_extension_current_extender; + + babl_extension_current_extender = babl_extension_quiet_log(); + + if (babl) + { + each_introspect (babl, NULL); + return; + } + babl_log ("Introspection report"); + babl_log ("===================================================="); - babl_log ("%s",""); - babl_log ("Data Types:%s", ""); + babl_log (""); + babl_log ("Data Types:"); babl_type_each (each_introspect, NULL); - babl_log ("%s",""); - babl_log ("Sampling (chroma subsampling) factors:%s", ""); + babl_log (""); + babl_log ("Sampling (chroma subsampling) factors:"); babl_sampling_each (each_introspect, NULL); - babl_log ("%s",""); - babl_log ("Components:%s", ""); + babl_log (""); + babl_log ("Components:"); babl_component_each (each_introspect, NULL); - babl_log ("%s",""); - babl_log ("Models (of components):%s", ""); + babl_log (""); + babl_log ("Models (of components):"); babl_model_each (each_introspect, NULL); - babl_log ("%s",""); - babl_log ("Pixel formats:%s", ""); + babl_log (""); + babl_log ("Pixel formats:"); babl_format_each (each_introspect, NULL); - babl_log ("%s",""); - babl_log ("conversions:%s", ""); + babl_log (""); + babl_log ("conversions:"); babl_conversion_each (each_introspect, NULL); - babl_log ("%s",""); - babl_log ("fishes:%s", ""); + babl_log (""); + babl_log ("extensions:"); + babl_extension_each (each_introspect, NULL); + babl_log (""); + babl_log ("fishes"); babl_fish_each (each_introspect, NULL); + babl_log (""); - babl_log ("%s", ""); + babl_extension_current_extender = extender_backup; #endif } diff --git a/babl/babl-introspect.h b/babl/babl-introspect.h index 5dc0e43..e9f580c 100644 --- a/babl/babl-introspect.h +++ b/babl/babl-introspect.h @@ -20,7 +20,9 @@ #ifndef _BABL_INTROSPECT_H #define _BABL_INTROSPECT_H +#include "babl-classes.h" + void -babl_introspect (void); +babl_introspect (Babl *babl); #endif diff --git a/babl/babl-memory.c b/babl/babl-memory.c index ff2026f..3f2b5d4 100644 --- a/babl/babl-memory.c +++ b/babl/babl-memory.c @@ -153,10 +153,9 @@ babl_memory_sanity (void) { if (frees != mallocs + strdups + callocs) { - fprintf (stderr, -"babl_memory usage does not add up!!!!!!!!\n" + babl_log ("memory usage does not add up!\n" "%s\n" -"balance: %i-%i=%i\n", +"\tbalance: %i-%i=%i\n", mem_stats(), (strdups+mallocs+callocs),frees, (strdups+mallocs+callocs)-frees); } } diff --git a/babl/babl-model.h b/babl/babl-model.h index 12df09b..3a19b02 100644 --- a/babl/babl-model.h +++ b/babl/babl-model.h @@ -21,6 +21,8 @@ #define _BABL_format_H #include "babl-classes.h" +#include "babl-instance.h" + BABL_DEFINE_CLASS (babl_model) #endif diff --git a/babl/babl-pixel-format.h b/babl/babl-pixel-format.h index 2a5f879..ed3329c 100644 --- a/babl/babl-pixel-format.h +++ b/babl/babl-pixel-format.h @@ -21,6 +21,8 @@ #define _BABL_FORMAT_H #include "babl-classes.h" +#include "babl-instance.h" + BABL_DEFINE_CLASS (babl_format) #endif diff --git a/babl/babl-sampling.h b/babl/babl-sampling.h index 6bc917b..cdedccc 100644 --- a/babl/babl-sampling.h +++ b/babl/babl-sampling.h @@ -21,8 +21,10 @@ #define _BABL_SAMPLING_H #include "babl-classes.h" +#include "babl-instance.h" -BABL_DEFINE_CLASS_NO_NEW_NO_ID(babl_sampling) Babl * babl_sampling (int horizontal, int vertical); + +BABL_DEFINE_CLASS_NO_NEW_NO_ID(babl_sampling) #endif diff --git a/babl/babl-sanity.c b/babl/babl-sanity.c index 88d9aa2..d68b848 100644 --- a/babl/babl-sanity.c +++ b/babl/babl-sanity.c @@ -152,7 +152,9 @@ static int id_sanity (Babl *babl, void *user_data) { - if (0 == babl->instance.id) + if (0 == babl->instance.id && + babl->instance.creator && + !strcmp(BABL(babl->instance.creator)->instance.name, "BablBase")) { OK=0; babl_log ("%s\t'%s' has id==0", diff --git a/babl/babl.c b/babl/babl.c index c0a83f9..d657326 100644 --- a/babl/babl.c +++ b/babl/babl.c @@ -19,9 +19,9 @@ #include "babl.h" #include "babl-internal.h" -#include "babl-base.h" #include "babl-sanity.h" #include "babl-introspect.h" +#include "babl-core.h" static int ref_count=0; @@ -36,7 +36,11 @@ babl_init (void) babl_model_init (); babl_format_init (); babl_conversion_init (); - babl_base_init (); + babl_core_init (); + babl_sanity (); + babl_extension_base (); + babl_sanity (); + babl_extension_init (); babl_sanity (); } } @@ -44,10 +48,9 @@ babl_init (void) void babl_destroy (void) { - /* babl_base is destroyed by the containing types */ - if (!--ref_count) { + babl_extension_destroy (); babl_fish_destroy (); babl_conversion_destroy (); babl_format_destroy (); diff --git a/babl/babl.h b/babl/babl.h index 900f3ed..e47eb91 100644 --- a/babl/babl.h +++ b/babl/babl.h @@ -37,9 +37,7 @@ #include "babl-sampling.h" #include "babl-pixel-format.h" - void babl_init (void); -void babl_introspect (void); void babl_destroy (void); #endif diff --git a/babl/base/Makefile.am b/babl/base/Makefile.am index c1b1d79..acfef18 100644 --- a/babl/base/Makefile.am +++ b/babl/base/Makefile.am @@ -5,7 +5,6 @@ h_sources = \ c_sources = \ babl-base.c \ cpercep.c \ - type-double.c \ type-float.c \ type-u8.c \ type-u16.c \ diff --git a/babl/base/babl-base.c b/babl/base/babl-base.c index 010bbb1..ee4ac51 100644 --- a/babl/base/babl-base.c +++ b/babl/base/babl-base.c @@ -43,7 +43,6 @@ babl_base_destroy (void) * types */ -void babl_base_type_double (void); void babl_base_type_float (void); void babl_base_type_u8 (void); void babl_base_type_u16 (void); @@ -51,8 +50,6 @@ void babl_base_type_u16 (void); static void types (void) { - babl_base_type_double (); /* must be registered first since it is the - reference */ babl_base_type_float (); babl_base_type_u8 (); babl_base_type_u16 (); @@ -70,8 +67,7 @@ void babl_base_model_lab (void); static void models (void) { - babl_base_model_rgb (); /* must be registered first since it is the - reference, (and contains the alpha definition) */ + babl_base_model_rgb (); babl_base_model_gray (); babl_base_model_lab (); babl_base_model_ycbcr (); diff --git a/babl/base/model-rgb.c b/babl/base/model-rgb.c index 23853d4..e76461f 100644 --- a/babl/base/model-rgb.c +++ b/babl/base/model-rgb.c @@ -38,26 +38,6 @@ babl_base_model_rgb (void) static void components (void) { - babl_component_new ( - "R", - "id", BABL_RED, - "luma", - "chroma", - NULL); - - babl_component_new ( - "G", - "id", BABL_GREEN, - "luma", - "chroma", - NULL); - - babl_component_new ( - "B", - "id", BABL_BLUE, - "luma", - "chroma", - NULL); babl_component_new ( "R'", @@ -81,12 +61,6 @@ components (void) NULL); - babl_component_new ( - "A", - "id", BABL_ALPHA, - "alpha", - NULL); - babl_component_new ( "R*A", "id", BABL_RED_MUL_ALPHA, @@ -114,14 +88,6 @@ components (void) static void models (void) { - babl_model_new ( - "rgba", - "id", BABL_RGBA, - babl_component_id (BABL_RED), - babl_component_id (BABL_GREEN), - babl_component_id (BABL_BLUE), - babl_component_id (BABL_ALPHA), - NULL); babl_model_new ( "rgb", @@ -300,9 +266,6 @@ premultiplied_to_non_premultiplied (int src_bands, } } - - - static void conversions (void) { diff --git a/docs/index-static.html.in b/docs/index-static.html.in index ff8739d..ef27502 100644 --- a/docs/index-static.html.in +++ b/docs/index-static.html.in @@ -202,6 +202,8 @@

Core

    +
  • Speed up name resolution in babl-db.h (using a hash table, and + probably also a id table)
  • Meta level optimizations.
  • Compile and/or runtime profiling. (The speed of conversions is bound to 'wobble', according to architecture, compiler flags, @@ -214,6 +216,16 @@ calculation should be 3.13159, but the result obtained was 3.14x10^0, the relative error is 0.00159/3.14159 => 0.0005 (source: 'A new book on c (cook1_0a.pdf)')
  • --> +
diff --git a/tests/Makefile.am b/tests/Makefile.am index 6a03c1c..f801c0b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -23,8 +23,7 @@ sanity_SOURCES = sanity.c AM_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/babl -LDADD = $(top_builddir)/babl/libbabl.la -lm - +LDADD = $(top_builddir)/babl/libbabl.la -lm -ldl noinst_PROGRAMS = \ introspect \ diff --git a/tests/introspect.c b/tests/introspect.c index 6712c21..84ff384 100644 --- a/tests/introspect.c +++ b/tests/introspect.c @@ -25,7 +25,7 @@ main (int argc, char **argv) { babl_init (); - babl_introspect (); + babl_introspect (NULL); babl_destroy (); return 0; } -- 2.30.2